const state = {
    products: []
}

const actions = {
    addProduct: ({ commit }, data) => {
        commit('CART_ADD_PRODUCT', data)
    },
    deleteProduct: ({ commit }, index) => {
        commit('CART_DELETE_PRODUCT', index)
    }
}

const mutations = {
    CART_ADD_PRODUCT: (state, data) => {
        state.products.push(data)
    },
    CART_DELETE_PRODUCT: (state, index) => {
        state.products.splice(index, 1)
    }
}

export default {
    state,
    actions,
    mutations
}